<template>
	<view class="index-container">
		<view class="banner">
			<u-swiper :list="swiperList" keyName="imgUrl" showTitle></u-swiper>
			
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiperList: []
			}
		},
		onLoad() {
			this.getSwiperList()

		},

		methods: {

			getSwiperList() {

				uni.request({
					url: 'http://127.0.0.1:8080/swiper/getAllSwiper',
					header: {
						'token': uni.getStorageSync('token')
					},
					method: "POST",
					success: (res) => {
						console.log('res', res)
						this.swiperList = res.data.data

						for (let i in this.swiperList) {
							this.swiperList[i].imgUrl = 'http://127.0.0.1:8080/blogimages/' + this.swiperList[
								i].imgUrl
						}

						// for (let s of res.data.data ) {

						// 	this.swiperList.push('http://127.0.0.1:8080/blogimages/'+s.imgUrl)

						// }
						// console.log('list', this.swiperList)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.index-container {
		margin-top: 5px;

		.banner {
			padding: 5px;
		}
	}
</style>
